"""
This package is meant to simplify the creating of html reports using jinja2.
"""

from jinja2 import Environment, FileSystemLoader, Template
from {{ module.lower() }} import {{ module }}
import os

__all__ = ['templates','get_template']

# This is a template environment for mapte
env = Environment(loader=FileSystemLoader(os.path.abspath({{ module }}.get_project_root()+'/src/html/templates')))


class templates(object):
	"""
	This class is a simple enumeration of existing templates.
	They return the template filename. (ie. table = 'table.html')

	"""
	table = 'table.html'
	highlight = 'highlight.html'
	seealso = 'seealso.html'
	link = 'link.html'


def get_template(name):
	"""
	Returns the jinja2 Template instance for the given template name.
	"""
	try:
		return env.get_template(name)
	except:
		raise


if __name__ == '__main__':
	
	table = get_template(templates.table)
	headers = ['FTN Classification Accuracy','<strong>Correct</strong>','<strong>Incorrect</strong>']
	rows = [['Initial', '<strong>15.6%</strong> (60/384)', '<strong>84.4%</strong> (324/384)'],
	        ['Final', '<strong>60.2%</strong> (231/384)', '<strong>39.8%</strong> (153/384)']]
	print table.render(headers=headers, rows=rows, _style="width:90%", _class="ctable", _id="main")
	
	temp = get_template(templates.highlight)
	print temp.render(num=10)
	print temp.render(num=50)
	print temp.render(num=76)
